﻿using System;
using System.Collections.Generic;
using System.Text;
using EnvDTE80;
using EnvDTE;
using Microsoft.VisualStudio.VCProjectEngine;

namespace iMainAddin
{
	namespace iItem
    {
        public class iReadytoStartWizard
        {
            public static iWizardInfo GetInfoFromExecuteMethod(object application, int hwndOwner, ref object[] contextParams
				, ref object[] customParams)
            {
                const int nWizardType = 0;
                iWizardInfo Info = null;

                if (string.Equals((string)contextParams[nWizardType], EnvDTE.Constants.vsWizardNewProject, System.StringComparison.CurrentCultureIgnoreCase))
                {
                    Info = new iSolutionInfo();
                    Info.SetContext(ref contextParams);
                }
                else if ((string)contextParams[nWizardType] == EnvDTE.Constants.vsWizardAddItem
                    || (string)contextParams[nWizardType] == EnvDTE.Constants.vsWizardAddSubProject)
                {
                    Info = new iItemInfo();
                    Info.SetContext(ref contextParams);
                }
                Info.rDte = (EnvDTE._DTE)application;
                if (Info.rDte != null && Info.rDte.Solution != null && Info.rDte.Solution.Projects != null)
                {
                    foreach (Project project in Info.rDte.Solution.Projects)
                    {
                        try
                        {
                            if (project.Name == Info.sProjectName)
                            {
                                switch (project.CodeModel.Language)
                                {
                                    case CodeModelLanguageConstants.vsCMLanguageMC: // MFC
                                    case CodeModelLanguageConstants.vsCMLanguageVC: // 일반 App
                                        //langs += "C++" + Environment.NewLine;
                                        break;
                                    case CodeModelLanguageConstants.vsCMLanguageCSharp: // C#
                                        //langs += "C#" + Environment.NewLine;
                                        break;
                                    case CodeModelLanguageConstants.vsCMLanguageVB: // VB
                                        //langs += "Visual Basic" + Environment.NewLine;
                                        break;
                                    case "{E6FDF8BF-F3D1-11D4-8576-0002A516ECE8}": // J#
                                        //'langs += "J#" + Environment.NewLine;
                                        break;
                                }
                            }
                        }
                        catch
                        {
                            return null;
                        }
                    }
                }
                return Info;
            }

        }
    }
}